
import {getOrderDetail} from '@/apilist/Supplier'
const state = {
  //公共数据
  order: {
   data: [],
    batch_id: '',
    company: '',
    name: '',
    limit_money: '',
    rows: '',
    start_at: '',
    end_at: '',
    desc: '',
    files: [],
  },


}

const mutations = {
  getOrderMutation(state,data){
    state.order.batch_id        = data.batch_id
    state.order.company         = data.company
    state.order.rows            = data.rows
    state.order.start_at        = data.start_at
    state.order.end_at          = data.end_at
    state.order.desc            = data.desc
    state.order.name            = data.name
    state.order.limit_money     = data.limit_money
    state.order.data            = data.list
    state.order.files           = data.files
  },
}

const actions = {
  async getOrderActions(ctx,data){
    let res = await getOrderDetail(data)
    sessionStorage.setItem('orderEndDate',res.data.end_at)
    ctx.commit('getOrderMutation',res.data)
  },
}


export default {
  namespaced: true,
  state,
  mutations,
  actions
}
